package vn.hut.soict.cs.phanquanghuy.neslegend.emulator;

import vn.hut.soict.cs.phanquanghuy.neslegend.emulator.cpu.CPU6502;
import vn.hut.soict.cs.phanquanghuy.neslegend.emulator.cpu.Instruction;
import vn.hut.soict.cs.phanquanghuy.neslegend.emulator.memory.CPURam;
import vn.hut.soict.cs.phanquanghuy.neslegend.emulator.memory.IORegisters;
import vn.hut.soict.cs.phanquanghuy.neslegend.emulator.util.NumberUtil;
import vn.hut.soict.cs.phanquanghuy.neslegend.emulator.util.RefBoolean;

public class EmulatorTest {
	
	public static void x(RefBoolean b) {
		b.setValue(true);
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {	
		
		
		RefBoolean b = new RefBoolean(false);
		x(b);
		
		CPURam ram = new CPURam();
		
		ram.writeMemory(0x0000, 10);
		
		IORegisters registers = new IORegisters();
		registers.writeMemory(0x2008, 10);
		
		int count = 0;
		for (int i = registers.offset(); i < registers.offset() + registers.length(); i++) {
			if (registers.readMemory(i) == ram.readMemory(0x0000)) {
				count++;
				System.out.println(count + ". " +Integer.toHexString(i)+ " : " + Integer.toHexString(registers.readMemory(i)) );
			}
		}
	}

}
